{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "7af1169a",
   "metadata": {},
   "source": [
    "阶段五模块三作业"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "45a4745e",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[ 84,  85,  74],\n",
       "        [ 82,  84,  94],\n",
       "        [ 60,  53,  51],\n",
       "        [ 81,  82,  81],\n",
       "        [ 55,  78,  52],\n",
       "        [ 93,  71,  56],\n",
       "        [ 81,  67,  56],\n",
       "        [ 88,  58,  71],\n",
       "        [ 51,  65,  63],\n",
       "        [ 62,  85,  52],\n",
       "        [ 76,  55,  79],\n",
       "        [ 67,  79,  73],\n",
       "        [ 97,  57,  60],\n",
       "        [ 57,  97,  75],\n",
       "        [ 91,  68,  97],\n",
       "        [ 79,  94,  60],\n",
       "        [100,  75,  66],\n",
       "        [ 99,  71,  74],\n",
       "        [ 81,  80,  71],\n",
       "        [ 71,  95,  64],\n",
       "        [ 60,  98,  81],\n",
       "        [ 80,  66,  90],\n",
       "        [ 50,  50,  66],\n",
       "        [ 69,  95,  85],\n",
       "        [ 76,  66,  95],\n",
       "        [ 92,  52,  51],\n",
       "        [ 59,  67,  85],\n",
       "        [ 88,  97,  53],\n",
       "        [ 76,  73,  68],\n",
       "        [ 74,  69,  62],\n",
       "        [ 96,  76,  57],\n",
       "        [ 93,  71,  63],\n",
       "        [ 99,  62,  95],\n",
       "        [ 77,  91,  68],\n",
       "        [ 92,  85,  60],\n",
       "        [ 92,  96,  50],\n",
       "        [ 61,  72,  66],\n",
       "        [ 89,  60,  92],\n",
       "        [ 71,  69,  65],\n",
       "        [ 56,  74,  57],\n",
       "        [ 68,  62,  98],\n",
       "        [ 51,  62,  61],\n",
       "        [ 77,  87,  82],\n",
       "        [ 92,  65,  82],\n",
       "        [ 57,  94,  93],\n",
       "        [ 65,  70,  92],\n",
       "        [ 90,  55,  85],\n",
       "        [ 83,  63,  77],\n",
       "        [ 87,  87,  80],\n",
       "        [ 88,  80,  70]],\n",
       "\n",
       "       [[ 91,  92,  68],\n",
       "        [ 90,  69,  62],\n",
       "        [ 63,  64,  84],\n",
       "        [ 65,  74,  89],\n",
       "        [ 71, 100,  64],\n",
       "        [ 74,  56,  69],\n",
       "        [ 80,  68,  81],\n",
       "        [ 81,  51,  91],\n",
       "        [ 84,  85,  93],\n",
       "        [ 78,  66,  83],\n",
       "        [ 67,  50,  77],\n",
       "        [ 63,  96,  51],\n",
       "        [ 61,  98,  96],\n",
       "        [ 55,  99,  77],\n",
       "        [ 76,  78,  93],\n",
       "        [ 99,  81,  84],\n",
       "        [ 81,  59,  66],\n",
       "        [ 60,  79,  58],\n",
       "        [ 51,  87,  94],\n",
       "        [ 65,  58,  91],\n",
       "        [ 79,  52,  62],\n",
       "        [ 68,  89,  74],\n",
       "        [ 94,  76,  94],\n",
       "        [ 62,  63,  94],\n",
       "        [ 56,  53,  66],\n",
       "        [ 71,  50,  71],\n",
       "        [ 92,  97,  55],\n",
       "        [ 73,  55,  58],\n",
       "        [ 83,  68,  93],\n",
       "        [ 51,  63,  67],\n",
       "        [ 81,  83,  83],\n",
       "        [ 61,  79,  66],\n",
       "        [ 82,  77,  89],\n",
       "        [ 72,  57,  85],\n",
       "        [ 91,  52,  54],\n",
       "        [ 81,  87,  71],\n",
       "        [ 52,  92, 100],\n",
       "        [ 54,  55,  94],\n",
       "        [ 79,  57,  88],\n",
       "        [ 92,  69,  91],\n",
       "        [ 57,  67,  71],\n",
       "        [ 53,  75,  58],\n",
       "        [ 93,  91,  74],\n",
       "        [ 56,  64,  87],\n",
       "        [ 50,  53,  91],\n",
       "        [ 88,  69,  79],\n",
       "        [ 92,  52,  55],\n",
       "        [ 84,  76,  92],\n",
       "        [ 60,  83,  94],\n",
       "        [ 55,  72,  80]],\n",
       "\n",
       "       [[ 90,  73,  83],\n",
       "        [ 68,  69,  51],\n",
       "        [ 51,  65,  67],\n",
       "        [ 57,  52,  93],\n",
       "        [ 55,  88,  94],\n",
       "        [ 56,  79,  79],\n",
       "        [ 76,  99,  91],\n",
       "        [ 95,  65, 100],\n",
       "        [ 91,  85,  83],\n",
       "        [ 72, 100,  70],\n",
       "        [ 78,  98,  58],\n",
       "        [ 76,  61,  95],\n",
       "        [ 62,  91,  64],\n",
       "        [ 63,  50,  99],\n",
       "        [ 55,  58,  90],\n",
       "        [ 95,  74,  82],\n",
       "        [ 95,  55,  78],\n",
       "        [ 84,  92,  68],\n",
       "        [ 69,  81,  72],\n",
       "        [ 64,  67,  87],\n",
       "        [ 60,  60,  95],\n",
       "        [ 64,  50,  86],\n",
       "        [ 87,  53,  99],\n",
       "        [ 51,  59,  63],\n",
       "        [ 58,  95,  59],\n",
       "        [ 91,  52,  50],\n",
       "        [ 83,  54,  90],\n",
       "        [ 83,  70,  85],\n",
       "        [ 91,  79,  54],\n",
       "        [ 73,  57,  83],\n",
       "        [ 91, 100,  78],\n",
       "        [ 59,  70,  66],\n",
       "        [ 65,  61,  50],\n",
       "        [ 53,  97,  73],\n",
       "        [ 78,  94,  92],\n",
       "        [ 52,  99,  87],\n",
       "        [ 63,  59,  76],\n",
       "        [ 75,  85,  68],\n",
       "        [ 59,  83,  88],\n",
       "        [ 86,  84,  78],\n",
       "        [ 58,  62,  77],\n",
       "        [ 50,  53,  75],\n",
       "        [ 77,  91,  74],\n",
       "        [ 63,  96,  54],\n",
       "        [ 91,  53,  83],\n",
       "        [ 81,  90,  66],\n",
       "        [ 59,  84,  77],\n",
       "        [ 50,  53,  53],\n",
       "        [ 78,  72,  87],\n",
       "        [ 76,  90,  72]],\n",
       "\n",
       "       [[ 83,  58,  64],\n",
       "        [ 92,  98,  87],\n",
       "        [ 97,  66,  92],\n",
       "        [ 89, 100,  98],\n",
       "        [ 75,  85,  58],\n",
       "        [ 67,  66,  51],\n",
       "        [ 93,  73,  95],\n",
       "        [ 80,  92,  77],\n",
       "        [ 90,  56,  80],\n",
       "        [ 50,  67,  72],\n",
       "        [ 54,  60,  60],\n",
       "        [ 75,  78,  68],\n",
       "        [ 87,  79,  57],\n",
       "        [ 60,  65,  67],\n",
       "        [ 66,  78,  52],\n",
       "        [ 80,  72,  50],\n",
       "        [ 64,  98,  84],\n",
       "        [100,  82,  55],\n",
       "        [ 50,  64,  82],\n",
       "        [ 88,  53, 100],\n",
       "        [ 72,  77,  85],\n",
       "        [ 56,  64,  54],\n",
       "        [ 56,  58,  55],\n",
       "        [ 59,  51, 100],\n",
       "        [ 73,  78,  84],\n",
       "        [ 68,  62,  76],\n",
       "        [ 93,  79,  99],\n",
       "        [ 70,  53,  81],\n",
       "        [ 81,  50,  64],\n",
       "        [ 96,  74,  92],\n",
       "        [ 88,  64,  78],\n",
       "        [ 89,  98,  61],\n",
       "        [ 60,  51,  95],\n",
       "        [ 77,  95,  84],\n",
       "        [ 74,  82,  71],\n",
       "        [ 52,  94,  85],\n",
       "        [ 82,  73,  90],\n",
       "        [ 60,  81,  81],\n",
       "        [ 85,  79,  60],\n",
       "        [ 51,  53,  84],\n",
       "        [ 72,  56,  56],\n",
       "        [ 64,  54,  92],\n",
       "        [ 99,  85,  91],\n",
       "        [ 64, 100,  56],\n",
       "        [ 90,  58,  60],\n",
       "        [ 54,  55,  72],\n",
       "        [ 81,  55,  56],\n",
       "        [ 96,  53,  84],\n",
       "        [ 81,  55,  84],\n",
       "        [ 94,  75,  97]],\n",
       "\n",
       "       [[ 71,  63,  86],\n",
       "        [ 96,  66,  60],\n",
       "        [ 52,  59,  85],\n",
       "        [ 63,  65,  59],\n",
       "        [ 67,  93,  62],\n",
       "        [ 83,  56,  93],\n",
       "        [ 71,  72,  76],\n",
       "        [ 92,  72,  52],\n",
       "        [ 73,  74,  72],\n",
       "        [ 61,  85,  60],\n",
       "        [ 66,  91,  58],\n",
       "        [ 88,  55,  77],\n",
       "        [ 50,  96,  66],\n",
       "        [ 63,  79,  77],\n",
       "        [ 70,  53,  90],\n",
       "        [ 61,  82,  73],\n",
       "        [ 73,  89,  58],\n",
       "        [ 79,  63,  91],\n",
       "        [ 51,  70,  97],\n",
       "        [ 87,  50,  87],\n",
       "        [ 80, 100,  72],\n",
       "        [ 53,  83,  69],\n",
       "        [ 72,  97,  81],\n",
       "        [ 71,  69,  87],\n",
       "        [ 91,  99,  97],\n",
       "        [ 64,  58,  59],\n",
       "        [ 83,  79,  80],\n",
       "        [ 72,  88,  67],\n",
       "        [ 78,  64,  70],\n",
       "        [ 55,  60,  74],\n",
       "        [ 71,  71,  75],\n",
       "        [ 53,  55,  61],\n",
       "        [ 59,  55,  54],\n",
       "        [ 88,  56,  62],\n",
       "        [ 58,  92,  63],\n",
       "        [ 67,  64,  57],\n",
       "        [ 98,  61,  90],\n",
       "        [ 84,  63,  82],\n",
       "        [ 64,  76,  50],\n",
       "        [ 89,  76,  88],\n",
       "        [ 68,  51,  65],\n",
       "        [ 85,  99,  94],\n",
       "        [100,  55,  90],\n",
       "        [ 96,  72,  60],\n",
       "        [ 89,  76,  61],\n",
       "        [ 99,  67,  90],\n",
       "        [ 64,  56,  59],\n",
       "        [ 56,  61,  85],\n",
       "        [ 66,  63,  80],\n",
       "        [ 65,  95,  89]],\n",
       "\n",
       "       [[ 99,  50,  66],\n",
       "        [ 58,  76,  94],\n",
       "        [ 51,  62,  69],\n",
       "        [ 79,  51,  85],\n",
       "        [ 99,  52,  98],\n",
       "        [ 83,  68,  99],\n",
       "        [ 52,  70,  93],\n",
       "        [ 83,  54,  97],\n",
       "        [ 50,  73,  95],\n",
       "        [ 83,  96,  71],\n",
       "        [ 78,  81,  96],\n",
       "        [ 72,  72,  72],\n",
       "        [ 54,  89,  74],\n",
       "        [ 79,  90,  59],\n",
       "        [ 73,  81,  79],\n",
       "        [ 67,  72,  72],\n",
       "        [ 81,  98,  78],\n",
       "        [ 84,  80,  67],\n",
       "        [ 82,  80,  68],\n",
       "        [ 66,  53,  67],\n",
       "        [ 63,  92,  68],\n",
       "        [ 99,  73,  99],\n",
       "        [ 74,  68,  80],\n",
       "        [ 85,  86,  86],\n",
       "        [ 73,  69,  76],\n",
       "        [ 67,  66,  69],\n",
       "        [ 80,  58,  92],\n",
       "        [ 64,  92,  72],\n",
       "        [ 76,  64,  50],\n",
       "        [ 63,  93,  79],\n",
       "        [ 80,  62,  57],\n",
       "        [ 92,  65,  95],\n",
       "        [ 61,  78,  64],\n",
       "        [ 69,  72,  75],\n",
       "        [ 84,  76,  70],\n",
       "        [ 61,  56,  55],\n",
       "        [ 67,  53,  50],\n",
       "        [ 68,  87,  75],\n",
       "        [ 94,  98,  96],\n",
       "        [ 90,  62,  83],\n",
       "        [ 80,  97,  59],\n",
       "        [ 88,  97,  79],\n",
       "        [ 54,  65,  52],\n",
       "        [ 95,  57,  59],\n",
       "        [ 83,  97,  80],\n",
       "        [ 76,  56,  94],\n",
       "        [ 90,  57,  68],\n",
       "        [ 86,  60,  78],\n",
       "        [ 99,  89,  76],\n",
       "        [ 85,  96,  61]]])"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "# 随机数生成六个班的考试成绩，3门考试：Python、数学、语文。每个班50人\n",
    "# 将成绩范围设置为50-100分\n",
    "a = np.random.randint(50,101,size = (6,50,3))\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "937f8b10",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(300, 3)"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 将六个班的考试层级进行合并得到score\n",
    "score = np.concatenate([a[0],a[1],a[2],a[3],a[4],a[5]],axis = 0)\n",
    "score\n",
    "np.shape(score)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "464a6d48",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1, 84, 85, 74],\n",
       "       [ 1, 82, 84, 94],\n",
       "       [ 0, 60, 53, 51],\n",
       "       ...,\n",
       "       [ 0, 86, 60, 78],\n",
       "       [ 0, 99, 89, 76],\n",
       "       [ 1, 85, 96, 61]])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 生成性别数组sex，水平叠加数组sex和score得到data\n",
    "# 男:1、女：0\n",
    "sex = np.random.randint(0,2,size = (300,1))\n",
    "data = np.hstack((sex,score))\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "e47e5759",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[  1,  84,  85,  74],\n",
       "       [  1,  82,  84,  94],\n",
       "       [  1,  51,  65,  63],\n",
       "       [  1,  76,  55,  79],\n",
       "       [  1,  67,  79,  73],\n",
       "       [  1,  97,  57,  60],\n",
       "       [  1,  57,  97,  75],\n",
       "       [  1,  91,  68,  97],\n",
       "       [  1,  79,  94,  60],\n",
       "       [  1,  99,  71,  74],\n",
       "       [  1,  81,  80,  71],\n",
       "       [  1,  71,  95,  64],\n",
       "       [  1,  60,  98,  81],\n",
       "       [  1,  50,  50,  66],\n",
       "       [  1,  92,  52,  51],\n",
       "       [  1,  88,  97,  53],\n",
       "       [  1,  74,  69,  62],\n",
       "       [  1,  77,  91,  68],\n",
       "       [  1,  92,  85,  60],\n",
       "       [  1,  92,  96,  50],\n",
       "       [  1,  89,  60,  92],\n",
       "       [  1,  56,  74,  57],\n",
       "       [  1,  68,  62,  98],\n",
       "       [  1,  51,  62,  61],\n",
       "       [  1,  77,  87,  82],\n",
       "       [  1,  92,  65,  82],\n",
       "       [  1,  65,  70,  92],\n",
       "       [  1,  90,  55,  85],\n",
       "       [  1,  88,  80,  70],\n",
       "       [  1,  91,  92,  68],\n",
       "       [  1,  90,  69,  62],\n",
       "       [  1,  63,  64,  84],\n",
       "       [  1,  65,  74,  89],\n",
       "       [  1,  71, 100,  64],\n",
       "       [  1,  81,  51,  91],\n",
       "       [  1,  84,  85,  93],\n",
       "       [  1,  78,  66,  83],\n",
       "       [  1,  67,  50,  77],\n",
       "       [  1,  63,  96,  51],\n",
       "       [  1,  61,  98,  96],\n",
       "       [  1,  55,  99,  77],\n",
       "       [  1,  76,  78,  93],\n",
       "       [  1,  99,  81,  84],\n",
       "       [  1,  60,  79,  58],\n",
       "       [  1,  65,  58,  91],\n",
       "       [  1,  94,  76,  94],\n",
       "       [  1,  62,  63,  94],\n",
       "       [  1,  56,  53,  66],\n",
       "       [  1,  71,  50,  71],\n",
       "       [  1,  92,  97,  55],\n",
       "       [  1,  73,  55,  58],\n",
       "       [  1,  81,  87,  71],\n",
       "       [  1,  52,  92, 100],\n",
       "       [  1,  54,  55,  94],\n",
       "       [  1,  92,  69,  91],\n",
       "       [  1,  56,  64,  87],\n",
       "       [  1,  50,  53,  91],\n",
       "       [  1,  92,  52,  55],\n",
       "       [  1,  90,  73,  83],\n",
       "       [  1,  51,  65,  67],\n",
       "       [  1,  57,  52,  93],\n",
       "       [  1,  55,  88,  94],\n",
       "       [  1,  95,  65, 100],\n",
       "       [  1,  91,  85,  83],\n",
       "       [  1,  78,  98,  58],\n",
       "       [  1,  76,  61,  95],\n",
       "       [  1,  62,  91,  64],\n",
       "       [  1,  63,  50,  99],\n",
       "       [  1,  84,  92,  68],\n",
       "       [  1,  64,  67,  87],\n",
       "       [  1,  60,  60,  95],\n",
       "       [  1,  58,  95,  59],\n",
       "       [  1,  83,  54,  90],\n",
       "       [  1,  73,  57,  83],\n",
       "       [  1,  65,  61,  50],\n",
       "       [  1,  59,  83,  88],\n",
       "       [  1,  58,  62,  77],\n",
       "       [  1,  50,  53,  75],\n",
       "       [  1,  77,  91,  74],\n",
       "       [  1,  91,  53,  83],\n",
       "       [  1,  59,  84,  77],\n",
       "       [  1,  50,  53,  53],\n",
       "       [  1,  83,  58,  64],\n",
       "       [  1,  92,  98,  87],\n",
       "       [  1,  75,  85,  58],\n",
       "       [  1,  67,  66,  51],\n",
       "       [  1,  93,  73,  95],\n",
       "       [  1,  90,  56,  80],\n",
       "       [  1,  87,  79,  57],\n",
       "       [  1,  66,  78,  52],\n",
       "       [  1,  80,  72,  50],\n",
       "       [  1,  64,  98,  84],\n",
       "       [  1, 100,  82,  55],\n",
       "       [  1,  50,  64,  82],\n",
       "       [  1,  72,  77,  85],\n",
       "       [  1,  56,  64,  54],\n",
       "       [  1,  59,  51, 100],\n",
       "       [  1,  73,  78,  84],\n",
       "       [  1,  93,  79,  99],\n",
       "       [  1,  70,  53,  81],\n",
       "       [  1,  88,  64,  78],\n",
       "       [  1,  89,  98,  61],\n",
       "       [  1,  60,  51,  95],\n",
       "       [  1,  74,  82,  71],\n",
       "       [  1,  82,  73,  90],\n",
       "       [  1,  90,  58,  60],\n",
       "       [  1,  54,  55,  72],\n",
       "       [  1,  96,  53,  84],\n",
       "       [  1,  81,  55,  84],\n",
       "       [  1,  94,  75,  97],\n",
       "       [  1,  71,  63,  86],\n",
       "       [  1,  96,  66,  60],\n",
       "       [  1,  52,  59,  85],\n",
       "       [  1,  83,  56,  93],\n",
       "       [  1,  71,  72,  76],\n",
       "       [  1,  92,  72,  52],\n",
       "       [  1,  73,  74,  72],\n",
       "       [  1,  61,  85,  60],\n",
       "       [  1,  88,  55,  77],\n",
       "       [  1,  50,  96,  66],\n",
       "       [  1,  63,  79,  77],\n",
       "       [  1,  73,  89,  58],\n",
       "       [  1,  51,  70,  97],\n",
       "       [  1,  87,  50,  87],\n",
       "       [  1,  53,  83,  69],\n",
       "       [  1,  55,  60,  74],\n",
       "       [  1,  88,  56,  62],\n",
       "       [  1,  58,  92,  63],\n",
       "       [  1,  67,  64,  57],\n",
       "       [  1,  64,  76,  50],\n",
       "       [  1,  89,  76,  88],\n",
       "       [  1,  85,  99,  94],\n",
       "       [  1,  96,  72,  60],\n",
       "       [  1,  99,  67,  90],\n",
       "       [  1,  64,  56,  59],\n",
       "       [  1,  56,  61,  85],\n",
       "       [  1,  66,  63,  80],\n",
       "       [  1,  51,  62,  69],\n",
       "       [  1,  79,  51,  85],\n",
       "       [  1,  52,  70,  93],\n",
       "       [  1,  50,  73,  95],\n",
       "       [  1,  83,  96,  71],\n",
       "       [  1,  78,  81,  96],\n",
       "       [  1,  79,  90,  59],\n",
       "       [  1,  82,  80,  68],\n",
       "       [  1,  63,  92,  68],\n",
       "       [  1,  99,  73,  99],\n",
       "       [  1,  74,  68,  80],\n",
       "       [  1,  85,  86,  86],\n",
       "       [  1,  92,  65,  95],\n",
       "       [  1,  69,  72,  75],\n",
       "       [  1,  61,  56,  55],\n",
       "       [  1,  68,  87,  75],\n",
       "       [  1,  94,  98,  96],\n",
       "       [  1,  88,  97,  79],\n",
       "       [  1,  83,  97,  80],\n",
       "       [  1,  90,  57,  68],\n",
       "       [  1,  85,  96,  61]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[  0,  60,  53,  51],\n",
       "       [  0,  81,  82,  81],\n",
       "       [  0,  55,  78,  52],\n",
       "       [  0,  93,  71,  56],\n",
       "       [  0,  81,  67,  56],\n",
       "       [  0,  88,  58,  71],\n",
       "       [  0,  62,  85,  52],\n",
       "       [  0, 100,  75,  66],\n",
       "       [  0,  80,  66,  90],\n",
       "       [  0,  69,  95,  85],\n",
       "       [  0,  76,  66,  95],\n",
       "       [  0,  59,  67,  85],\n",
       "       [  0,  76,  73,  68],\n",
       "       [  0,  96,  76,  57],\n",
       "       [  0,  93,  71,  63],\n",
       "       [  0,  99,  62,  95],\n",
       "       [  0,  61,  72,  66],\n",
       "       [  0,  71,  69,  65],\n",
       "       [  0,  57,  94,  93],\n",
       "       [  0,  83,  63,  77],\n",
       "       [  0,  87,  87,  80],\n",
       "       [  0,  74,  56,  69],\n",
       "       [  0,  80,  68,  81],\n",
       "       [  0,  81,  59,  66],\n",
       "       [  0,  51,  87,  94],\n",
       "       [  0,  79,  52,  62],\n",
       "       [  0,  68,  89,  74],\n",
       "       [  0,  83,  68,  93],\n",
       "       [  0,  51,  63,  67],\n",
       "       [  0,  81,  83,  83],\n",
       "       [  0,  61,  79,  66],\n",
       "       [  0,  82,  77,  89],\n",
       "       [  0,  72,  57,  85],\n",
       "       [  0,  91,  52,  54],\n",
       "       [  0,  79,  57,  88],\n",
       "       [  0,  57,  67,  71],\n",
       "       [  0,  53,  75,  58],\n",
       "       [  0,  93,  91,  74],\n",
       "       [  0,  88,  69,  79],\n",
       "       [  0,  84,  76,  92],\n",
       "       [  0,  60,  83,  94],\n",
       "       [  0,  55,  72,  80],\n",
       "       [  0,  68,  69,  51],\n",
       "       [  0,  56,  79,  79],\n",
       "       [  0,  76,  99,  91],\n",
       "       [  0,  72, 100,  70],\n",
       "       [  0,  55,  58,  90],\n",
       "       [  0,  95,  74,  82],\n",
       "       [  0,  95,  55,  78],\n",
       "       [  0,  69,  81,  72],\n",
       "       [  0,  64,  50,  86],\n",
       "       [  0,  87,  53,  99],\n",
       "       [  0,  51,  59,  63],\n",
       "       [  0,  91,  52,  50],\n",
       "       [  0,  83,  70,  85],\n",
       "       [  0,  91,  79,  54],\n",
       "       [  0,  91, 100,  78],\n",
       "       [  0,  59,  70,  66],\n",
       "       [  0,  53,  97,  73],\n",
       "       [  0,  78,  94,  92],\n",
       "       [  0,  52,  99,  87],\n",
       "       [  0,  63,  59,  76],\n",
       "       [  0,  75,  85,  68],\n",
       "       [  0,  86,  84,  78],\n",
       "       [  0,  63,  96,  54],\n",
       "       [  0,  81,  90,  66],\n",
       "       [  0,  78,  72,  87],\n",
       "       [  0,  76,  90,  72],\n",
       "       [  0,  97,  66,  92],\n",
       "       [  0,  89, 100,  98],\n",
       "       [  0,  80,  92,  77],\n",
       "       [  0,  50,  67,  72],\n",
       "       [  0,  54,  60,  60],\n",
       "       [  0,  75,  78,  68],\n",
       "       [  0,  60,  65,  67],\n",
       "       [  0,  88,  53, 100],\n",
       "       [  0,  56,  58,  55],\n",
       "       [  0,  68,  62,  76],\n",
       "       [  0,  81,  50,  64],\n",
       "       [  0,  96,  74,  92],\n",
       "       [  0,  77,  95,  84],\n",
       "       [  0,  52,  94,  85],\n",
       "       [  0,  60,  81,  81],\n",
       "       [  0,  85,  79,  60],\n",
       "       [  0,  51,  53,  84],\n",
       "       [  0,  72,  56,  56],\n",
       "       [  0,  64,  54,  92],\n",
       "       [  0,  99,  85,  91],\n",
       "       [  0,  64, 100,  56],\n",
       "       [  0,  81,  55,  56],\n",
       "       [  0,  63,  65,  59],\n",
       "       [  0,  67,  93,  62],\n",
       "       [  0,  66,  91,  58],\n",
       "       [  0,  70,  53,  90],\n",
       "       [  0,  61,  82,  73],\n",
       "       [  0,  79,  63,  91],\n",
       "       [  0,  80, 100,  72],\n",
       "       [  0,  72,  97,  81],\n",
       "       [  0,  71,  69,  87],\n",
       "       [  0,  91,  99,  97],\n",
       "       [  0,  64,  58,  59],\n",
       "       [  0,  83,  79,  80],\n",
       "       [  0,  72,  88,  67],\n",
       "       [  0,  78,  64,  70],\n",
       "       [  0,  71,  71,  75],\n",
       "       [  0,  53,  55,  61],\n",
       "       [  0,  59,  55,  54],\n",
       "       [  0,  98,  61,  90],\n",
       "       [  0,  84,  63,  82],\n",
       "       [  0,  68,  51,  65],\n",
       "       [  0, 100,  55,  90],\n",
       "       [  0,  89,  76,  61],\n",
       "       [  0,  65,  95,  89],\n",
       "       [  0,  99,  50,  66],\n",
       "       [  0,  58,  76,  94],\n",
       "       [  0,  99,  52,  98],\n",
       "       [  0,  83,  68,  99],\n",
       "       [  0,  83,  54,  97],\n",
       "       [  0,  72,  72,  72],\n",
       "       [  0,  54,  89,  74],\n",
       "       [  0,  73,  81,  79],\n",
       "       [  0,  67,  72,  72],\n",
       "       [  0,  81,  98,  78],\n",
       "       [  0,  84,  80,  67],\n",
       "       [  0,  66,  53,  67],\n",
       "       [  0,  73,  69,  76],\n",
       "       [  0,  67,  66,  69],\n",
       "       [  0,  80,  58,  92],\n",
       "       [  0,  64,  92,  72],\n",
       "       [  0,  76,  64,  50],\n",
       "       [  0,  63,  93,  79],\n",
       "       [  0,  80,  62,  57],\n",
       "       [  0,  61,  78,  64],\n",
       "       [  0,  84,  76,  70],\n",
       "       [  0,  67,  53,  50],\n",
       "       [  0,  90,  62,  83],\n",
       "       [  0,  80,  97,  59],\n",
       "       [  0,  54,  65,  52],\n",
       "       [  0,  95,  57,  59],\n",
       "       [  0,  76,  56,  94],\n",
       "       [  0,  86,  60,  78],\n",
       "       [  0,  99,  89,  76]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 分别计算男女生各科成绩统计指标：最小值、最大值、平均分、中位数、标准差\n",
    "cond = data[:,0] == 1\n",
    "cond1 = data[:,0] == 0\n",
    "# 男生成绩\n",
    "data1 = data[cond]\n",
    "# 女生成绩\n",
    "data2 = data[cond1]\n",
    "display(data1,data2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "39cf32ce",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "50"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 男生各科成绩统计指标\n",
    "# 最小值\n",
    "data1[:,1:4].min()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "b14ef465",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "100"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 最大值\n",
    "data1[:,1:4].max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "0e0ea54e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "74.35654008438819"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 平均分\n",
    "data1[:,1:4].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "1f7bfa9a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "74.0"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 中位数\n",
    "np.median(data1[:,1:4]) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "b8814f4c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "14.996254435715404"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 标准差\n",
    "data1[:,1:4].std()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "88ffbe26",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "50"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 女生各科成绩统计指标\n",
    "# 最小值\n",
    "data2[:,1:4].min()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "97189c14",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "100"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 最大值\n",
    "data2[:,1:4].max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "e0059c86",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "73.92723004694835"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 平均分\n",
    "data2[:,1:4].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "24760a18",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "73.0"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 中位数\n",
    "np.median(data2[:,1:4]) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "a816a772",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "14.153148269638935"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 标准差\n",
    "data2[:,1:4].std()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "50d08b46",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.10"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
